using System.IO;
using fit;

namespace fat
{
	public class ReferenceFixture: ColumnFixture
	{
		public string Description;
		public string Location;
		public string Note;

		public string Result()
		{
			string inputFileName = "../../spec/" + Location;
			string outputFileName = "output/spec/" + Location;
			try
			{
				FileRunner runner = new FileRunner();
				runner.args(new string[] {inputFileName, outputFileName});
				runner.process();
				runner.output.Close();

				Counts runnerFixtureCounts = runner.fixture.counts;
				if ((runnerFixtureCounts.exceptions == 0) && (runnerFixtureCounts.wrong == 0))
				{
					return "pass";
				}
				else
				{
					return
						"fail: " + runnerFixtureCounts.right + " right, " + runnerFixtureCounts.wrong + " wrong, " +
						runnerFixtureCounts.exceptions + " exceptions";
				}
			}
			catch (IOException)
			{
				return "file not found: " + new FileInfo(inputFileName).FullName;
			}
		}
	}
}